home *** CD-ROM | disk | FTP | other *** search
- Path: fido.asd.sgi.com!austern
- From: jarausch@igpm.rwth-aachen.de (Helmut Jarausch)
- Newsgroups: comp.std.c++
- Subject: Binding a temperary to a non const ref - status of the rules?
- Date: 08 Feb 1996 10:11:01 PST
- Organization: RWTH Aachen (Inst. f. Geometrie & Prakt. Mathematik)
- Approved: austern@isolde.mti.sgi.com
- Message-ID: <4fd0t6$8n5@news.rwth-aachen.de>
- NNTP-Posting-Host: isolde.mti.sgi.com
- X-Original-Date: 8 Feb 1996 14:21:26 GMT
- X-Newsreader: xrn 7.00 (Motif)
- X-Auth: PGPMoose V1.1 PGP comp.std.c++
- iQBVAwUBMRo8zUy4NqrwXLNJAQFT5wH/Rve1Tbo9DeTObDFRHcuW6N/KGPKYUGOz
- N8sy3dlbyS6OdQ5hFoPH3qq1BtmMdTir+ShYyujwvLT0gc/RP2UBzw==
- =CxV4
- Originator: austern@isolde.mti.sgi.com
-
- Please comment on the following ( I know there is a connection to the
- auto_ptr discussion, but I am not quite sure about this).
- Thank you very much,
- Helmut Jarausch.
-
- ========================
-
- Assume
-
- class Vector { ... }
-
- class Vector_R : public Vector
- { // a smart reference to a Vector using reference counts,
- freeing temp. storage immediately after use
- ...
- }
-
- class Matrix
- { // Data stored columnwise
- ...
-
- const Vector_R operator[]( int k ) const; // return k-th column vector
- Vector_R operator[]( int k ); // return k-th column vector
- ...
- }
-
- ostream& operator<<( ostream&, const Vector&);
- istream& operator>>( istream&, Vector& );
-
- Matrix V;
- const Matrix K;
-
-
- Now I would like the following behaviour (is this true (or will it be) ? )
-
- cout << V[1] << K[1]; // should be OK
- cout >> V[1]; // should be OK (even no warning)
- cout >> K[1]; // should be an ERROR - not only a warning
- ---
- [ comp.std.c++ is moderated. Submission address: std-c++@ncar.ucar.edu.
- Contact address: std-c++-request@ncar.ucar.edu. The moderation policy is
- in http://reality.sgi.com/employees/austern_mti/std-c++/policy.html. ]
-